using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class LoginController:Singleton<LoginController>
{
    LoginModel log_Model=new LoginModel();
    LoginView log_View = new LoginView();
    public void InitRoot()
    {
        log_Model.InitData();
        log_View.OnCreatPanel();
        OnStart();
    }
    public void OnStart()
    {
        log_View.sureLogin.onClick.AddListener(() => 
        {
            for (int i = 0; i < log_Model.list_PlayerAccountDatas.Count; i++)
            {
                if (log_View.userName.text== log_Model.list_PlayerAccountDatas[i].userName&& log_View.userPassword.text == log_Model.list_PlayerAccountDatas[i].userPassword)
                {
                    PanelManager.Instance.UIGamePanel.SetActive(true);
                    PanelManager.Instance.UILoginPanel.SetActive(false);
                }
            }
        });
    }
    // Update is called once per frame
    void Update()
    {
        
    }
}
